package com.fjec.market.config;

import com.fjec.common.okhttp.OkHttp;
import com.fjec.common.setting.SystemMessage;
import com.fjec.common.ys.PaidHelper;
import com.fjec.common.ys.YsProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppConfig {

    @Bean
    @ConfigurationProperties(prefix = "fjec.im.system.message")
    public SystemMessage systemMessage() {
        return new SystemMessage();
    }

    @Bean("okHttp")
    public OkHttp okHttp() {
        OkHttp okHttp = new OkHttp(20, 20, 20, true);
        okHttp.init();
        return okHttp;
    }

    @Bean
    @ConfigurationProperties(prefix = "ysapi")
    public YsProperties ysProperties() {
        YsProperties ysProperties = new YsProperties();
        return ysProperties;
    }

    @Bean
    public PaidHelper paidHelper(OkHttp okHttp, YsProperties ysProperties) {
        return new PaidHelper(okHttp, ysProperties);
    }
}
